package main

import (
	"fmt"
)

func insertSort(arr *[5]int) {


	for i := 1; i < len(arr); i++ {

		insertVal := arr[i]
		insertIndex := i - 1
		for insertIndex >= 0 && arr[insertIndex] < insertVal {
			arr[insertIndex + 1] = arr[insertIndex] // 后移
			insertIndex--
		}

		// 插入
		if insertIndex + 1 != i {
			arr[insertIndex + 1] = insertVal
		}

	}

	fmt.Println(*arr)
}

func main() {

	arr := [5]int{23, 0, 12, 56, 34}
	insertSort(&arr)

}